<?php
/**
 * Created by PhpStorm.
 * User: man0sions
 * Date: 16/8/27
 * Time: 下午3:45
 */

namespace src\base\api;
use src\base\Factory;

/**
 * Class SqlBuilder
 * 用于构造sql语句的接口
 * @package src\base\api
 */

abstract class SqlBuilder
{
    protected $table;
    protected $fields;
    protected $params;
    protected $dbStrategy;

    /**
     * SqlBuilder constructor.
     * @param $table 表名称
     * @param array $params 参数
     * @param DbStrategy $dbStrategy
     */
    function __construct($table,$fields=[],$params=[],DbStrategy $dbStrategy)
    {
        $this->dbStrategy = $dbStrategy;
        $this->table = $table;
        $this->params = $params;
        $this->fields = join(',',$fields);
    }

    abstract function build();
}
//
//
//class SelectSqlBuilder extends SqlBuilder{
//
//    function build()
//    {
//    }
//}
//
//class UpdateSqlBuilder extends SqlBuilder{
//
//    function build()
//    {
//    }
//}
//
//class InsertSqlBuilder extends SqlBuilder{
//    function build()
//    {
//    }
//}
//
//class DeleteSqlBuilder extends SqlBuilder{
//    function build()
//    {
//    }
//}

